package com.hmo.appshop;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.viewpager.widget.ViewPager;

import com.hmo.appshop.databinding.PrePageViewBinding;

import java.util.List;
import java.util.Objects;

public class PreDialog extends DialogFragment {

    private List<Bitmap> bitmaps;
    private PrePageViewBinding inflate;
//    public PreDialog(List<Bitmap> bitmaps) {
//        this.bitmaps=bitmaps;
//    }



    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Objects.requireNonNull(Objects.requireNonNull(getDialog()).getWindow()).setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); //去除默认白色边框
        inflate = PrePageViewBinding.inflate(inflater, container, false);
        return inflate.getRoot();
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ViewPager viewPager = inflate.pViewPager;
        viewPager.setBackgroundColor(Color.TRANSPARENT);

        viewPager.setAdapter(DetailsActivity.pagerViewAdapter);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        inflate=null;
    }


}